package com.imti.mall.product.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.imti.mall.model.pms.pojo.PmsMemberPrice;
import com.imti.mall.product.dao.PmsMemberPriceDao;
import com.imti.mall.product.service.PmsMemberPriceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class PmsMemberPriceServiceImpl extends ServiceImpl<PmsMemberPriceDao, PmsMemberPrice> implements PmsMemberPriceService {
    @Autowired
    PmsMemberPriceDao pmsMemberPriceDao;
    /**
     * 根据商品id查询商品会员价格
     * @param id
     * @return
     */
    @Override
    public List<PmsMemberPrice> getPmsMemberPriceId(Integer id) {
        return pmsMemberPriceDao.getPmsMemberPriceId(id);
    }
    /**
     * 根据商品会员id修改商品会员价格
     * @param pmsMemberPrice
     * @return
     */
    @Override
    public Integer upadtePmsMemberPrice(PmsMemberPrice pmsMemberPrice) {
        return pmsMemberPriceDao.updatePmsMemberPrice(pmsMemberPrice);
    }
    /**
     * 查询全部商品会员价格
     * @return
     */
    @Override
    public List<PmsMemberPrice> findPmsMemberPrice() {
        return pmsMemberPriceDao.selectList(null);
    }
    /**
     * 根据商品会员id查询会员表
     * @return
     */
    @Override
    public PmsMemberPrice findPmsMemberPriceById(Integer id) {
        return pmsMemberPriceDao.selectById(id);
    }
    /**
     * 添加会员
     * @return
     */
    @Override
    public Integer addPmsMemberPrice(PmsMemberPrice pmsMemberPrice) {
        return pmsMemberPriceDao.insert(pmsMemberPrice);
    }
    /**
     * 根据商品商品会员价格id删除
     * @return
     */
    @Override
    public Integer delPmsMemberPrice(Integer id) {
        return pmsMemberPriceDao.deleteById(id);
    }

    @Override
    public boolean addList(List<PmsMemberPrice> memberPriceList) {
        return saveBatch(memberPriceList);
    }

    @Override
    public boolean updateList(List<PmsMemberPrice> memberPriceList) {
        return saveOrUpdateBatch(memberPriceList);
    }

    @Override
    public boolean deleteList(List<PmsMemberPrice> memberPriceList) {
        return removeByIds(memberPriceList);
    }
}
